Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API error: improve error message #260

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chantra
Copy link

@chantra chantra commented Feb 8, 2024

Previously, a generic error would be returned:

Error: unexpected HTTP status 404 Not Found

This does not convey much information as to what happens. On the current version of dkregistry, one would hit this when trying to access s390x/ubuntu on registry-1.docker.io.

This change specializes the error to surface more information as to why the error is happening as described in the OCI Distribution Specification: https://github.com/opencontainers/distribution-spec/blob/main/spec.md#error-codes

In this specific case, the error would look like:

Error: Api Error: ((MANIFEST_UNKNOWN), message: OCI manifest found, but accept header does not support OCI manifests)

Caused by:
    ((MANIFEST_UNKNOWN), message: OCI manifest found, but accept header does not support OCI manifests)

which clearly highlight that dkregistry does not support OCI manifest.

@chantra chantra marked this pull request as draft February 8, 2024 23:15
@chantra
Copy link
Author

chantra commented Feb 8, 2024

I need a minor change and will add testing.

@chantra chantra force-pushed the http_error_code branch 2 times, most recently from c2ff4ad to c8bad71 Compare February 9, 2024 04:20
@chantra chantra marked this pull request as ready for review February 9, 2024 04:23
@chantra
Copy link
Author

chantra commented Feb 9, 2024

added test against fixtures and a test-net test.

Previously, a generic error would be returned:
```
Error: unexpected HTTP status 404 Not Found
```

This does not convey much information as to what happens.
On the current version of dkregistry, one would hit this when trying to
access s390x/ubuntu on registry-1.docker.io.

This change specializes the error to surface more information as to why the
error is happening as described in the OCI Distribution Specification:
https://github.com/opencontainers/distribution-spec/blob/main/spec.md#error-codes

In this specific case, the error would look like:
```
Error: Api Error: ((MANIFEST_UNKNOWN), message: OCI manifest found, but accept header does not support OCI manifests)

Caused by:
    ((MANIFEST_UNKNOWN), message: OCI manifest found, but accept header does not support OCI manifests)
```

which clearly highlight that dkregistry does not support OCI manifest.
@chantra
Copy link
Author

chantra commented Feb 13, 2024

@PratikMahajan any possibilities you look into this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant